package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsEventReadDao;
import com.party.core.dao.write.analysis.StatisticsEventWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.StatisticsEvent;
import com.party.core.service.analysis.IStatisticsEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 统计事件接口实现
 * @author: Huaqunhao
 * @create: 2018-08-01 11:55
 **/
@Service
@Transactional
public class StatisticsEventService implements IStatisticsEventService {
    @Autowired
    private StatisticsEventReadDao statisticsEventReadDao;
    @Autowired
    private StatisticsEventWriteDao statisticsEventWriteDao;

    @Override
    public String insert(StatisticsEvent statisticsEvent) {
        BaseModel.preInsert(statisticsEvent);
        boolean result = statisticsEventWriteDao.insert(statisticsEvent);
        if (result) {
            return statisticsEvent.getId();
        }
        return null;
    }

    @Override
    public boolean update(StatisticsEvent statisticsEvent) {
        statisticsEvent.setUpdateDate(new Date());
        return statisticsEventWriteDao.update(statisticsEvent);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return statisticsEventWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public StatisticsEvent get(String id) {
        return statisticsEventReadDao.get(id);
    }

    @Override
    public List<StatisticsEvent> listPage(StatisticsEvent statisticsEvent, Page page) {
        return statisticsEventReadDao.listPage(statisticsEvent,page);
    }

    @Override
    public List<StatisticsEvent> list(StatisticsEvent statisticsEvent) {
        return null;
    }

    @Override
    public List<StatisticsEvent> batchList(Set<String> ids, StatisticsEvent statisticsEvent, Page page) {
        return null;
    }

    @Override
    public List<StatisticsEvent> listAll() {
        StatisticsEvent event = new StatisticsEvent();
        return statisticsEventReadDao.listPage(event, null);
    }

    @Override
    public StatisticsEvent getByCode(String code) {
        return statisticsEventReadDao.getByCode(code);
    }

    @Override
    public StatisticsEvent getEvent(StatisticsEvent statisticsEvent) {
        return statisticsEventReadDao.getEvent(statisticsEvent);
    }

    @Override
    public List<StatisticsEvent> queryEventList() {
        return statisticsEventReadDao.queryEventList();
    }

    @Override
    public List<StatisticsEvent> countList(Map<String,Object> map) {
        return statisticsEventReadDao.countList(map);
    }

    @Override
    public List<StatisticsEvent> webListPage(StatisticsEvent statisticsEvent, Map<String, Object> params, Page page) {
        return statisticsEventReadDao.webListPage(statisticsEvent,params,page);
    }

    @Override
    public Long getEventNum(String eventId, Map<String, Object> params) {
        return statisticsEventReadDao.getEventNum(eventId,params);
    }

    @Override
    public List<StatisticsEvent> listPageByOthers(StatisticsEvent eventCounter, Map<String, Object> params, Page page) {
        return statisticsEventReadDao.listPageByOthers(eventCounter, params, page);
    }

    @Override
    public List<StatisticsEvent> listPageByOrgIds(StatisticsEvent eventCounter, Map<String, Object> params, Page page) {
        return statisticsEventReadDao.listPageByOrgIds(eventCounter,params,page);
    }
}
